Rules are created in the same way as virtual hosts:
On the "List of Rules" page, you will
- Click on a insert location
- Click on "Insert"
- Select the new entry
- Click on "Edit"
You will be presented by the "Edit Rule" page:
Name
This field contains the name of the rule. It is mainly for your orientation,
but will be used for the "Jump" command, so take care that you
have unique names if you use this feature.
disabled
To disable this rule temporarily, check this setting
Wildcard Formulars (Path, Host, Referer, Language, Browser)
To get specific parts out of the input parameters, rules can define search
strings for each of the five parameters. Those search strings are built
out of normal text and can contain several different wildcards.
When a request is processed by a rule, Welcome will try to match each search
string in the five fields against the real value. This will give all wildcards
in the search strings a value that can be used to build the resulting path
for that rule. If you don't need a specific parameter, you can leave the
field empty.
Example:
A request has a referer "http://www.somewhere.com/foo.html". A
rule has the wildcard formular for Referer: "*/*.html". As "*"is a wildcard for any text, Welcome will try to match "*/*.html"against "http://www.somewhere.com/foo.html" and this can only
be if the first "*" stands for "http://www.somewhere.com"and the second "*" stands for "foo". You will later
learn how to insert the two values into the resulting path with "<R1>"and "<R2>".
In the wildcards section, you will learn
how to use wildcards in the five fields.
Description of typical content of the five fields:
- Path: will point to the part of the url after the host. If someone
types e.g. "http://welcome.comcon.de/pages/download.html", the
path will be "/[subfolder of virtual host welcome]/pages/download.html".
As you can see, the path always starts with the virtual subfolder,
because rules are executed after the virtual hosting. You can use
this feature to restrict rules to specific hosts if you enter e.g. /welcome/*.html
which will match any HTML page in the virtual host that is contained in
the subfolder "welcome".
Note, that Path: will also contain any path- and search-arguments. A typical
path would be e.g. "/lasso.acgi$function=...". Knowing this,
you can rebuild a query to a folder path and back - hiding the implementation
of your web database from the public.
- Host: wil point to the requested host (without "http://").
Examples are: "welcome.comcon.de" or "128.0.0.1" or
"cool.com:8080"
- Referer: will point to a full qualified URL like "http://welcome.comcon.de"
- Language: will point to a string that contains the language
tokens a user can configure in his/her browser. There may be no, one or
many tokens that are separated by "," or spaces or both. You
cannot rely on the delimiter to be the same for all browsers. Tip:
Netscape shows language tokens after the list entries inside the brackets
[] and will separate them with ",[space]".
- Browser: will point to the version string that browsers, robots
or scripts will send with the request. This can be of any syntax, but to
learn how these strings look like, you can set your servers logging options
to include this entry and search through the log. Tip: Netscape uses "Mozilla" inside the string, but beware that Internet Exploder will also use "Mozilla" to be compatible.
Wildcard Evaluation
This section will act on the values you have defined in the previous section.
In any of the fields in this section you can use references to the the wildcards,
which will be replaced by the real wildcard values.
Execute Condition
In this field, you can restrict the execution of this rule. If it is left
empty, the rule is always executed. If it contains a boolean expression,
Welcome will evaluate this expression and this will control the rule execution.
Example:
To restrict the execution of the rule to only those requests that contain
a referer, we will enter "*" in the Referer: field and enter "<R0>"in the condition.
In the references to wildcards section,
you will learn how to build boolean expressions.
Path Result
This is the output of the rule. All text and any reference in this field
will replace the previous value of the requested path. This will enable
each rule to modify the incoming request. If you leave this field empty,
the rule will not touch the path. If you like to create a redirect, you
should start the url in this field with "http://"
Example:
To use the value of the second "*" from the first example in the
path result, we could write "/myscript?<R2>" in the field.
This will evaluate to "/myscript?foo" and this will be the requests
path after the rule has been executed.
In the references to wildcards section,
you will learn how to use references to wildcards in this field.
Redirection
If you check this setting, the rule will stop executing the rule list. A
redirect with the value of "Path Result:" will be sent back, so
take care, that the string in "Path Result:" starts with "http://".
Jump To
This field is used to change the order in which rules are executed. If left
empty, rules are executed from top to bottom in the rule list. There are
different values you can define in this field:
- "stop" - will stop executing rules (fastest way to exit)
- [a name of a rule or an expression] - will jump to the rule with this
name (case sensitive). If this rule does not exist, execution stops
In the references to wildcards section,
you will learn how to use references to wildcards in this field. |